10 '  BUDGET MANAGEMENT - REPORT
100 CLEAR (3600) : DEFINT I - N
110 M1 = 61 : M2 = 50 : M3 = 25 : M4 = 20 : M5 = M4
120 AD$ = CHR$ (25) : EL$ = CHR$ (30) : CU$ = CHR$ (27) : BL$ = CHR$ (29)
130 DIM A1%(M1),A2$(M1),A3#(M1),A4#(M1),A6%(M1)
140 DIM C1%(M2),C2%(M2),C3$(M2),C4(M2),C5%(M2),C6%(M2)
150 DIM E1%(M3),E2$(M3),E3(M3),E4%(M3)
160 DIM D1%(M4),D2$(M4),D3(M4)
170 DIM S1%(M5),S2$(M5),S3(M5)
190 ON ERROR GOTO 200 : DK = 1 : I = INSTR ("A","A") : GOTO 210
200 DK = 0 : RESUME 210
210 ON ERROR GOTO 0
220 CLS : PRINT : PRINT TAB( 10)"BUDGET MANAGEMENT - REPORT " : PRINT
230 IF DT<10100 THEN PRINT "ENTER TODAY'S DATE (MM/DD/YY)";:X%=1:GOSUB 900:DT=VAL(DT$):X%=0:GOTO 220
240 PRINT TAB( 15)"0) STOP
" TAB( 15)"1) READ-IN MORE DATA
" TAB( 15)"2) REPORT
260 PRINT : J = 3 : INPUT "ENTER YOUR CHOICE";J
270 IF J = 0 THEN E = 99 : GOSUB 5000
275 IF (J-1)*(J-2)<>0 GOTO 220 ELSE IF F=0 AND J=2 THEN GOSUB 9500
280 ON J GOSUB 9500,2000 : GOTO 220
290 C$ = LEFT$ (C$ + " " + STRING$ (30,"."),30) : RETURN 
300 YN = - 1 : INPUT B$ : IF B$ = "" THEN B$ = C$
305 C$ = LEFT$ (B$,1) : IF C$ = "Y" THEN YN = 1 : RETURN :ELSE IF C$ = "N" THEN YN = 0 : RETURN 
310 PRINT "WAKE UP! PLEASE ANSWER YES(Y), OR NO(N)"; : IF F1 = 1 THEN RETURN : :ELSE 300
320 FOR DY = 1 TO 1000 : NEXT : RETURN 
400 CLS : PRINT TAB( 18); : ON J GOTO 401,402
401 PRINT "DATA INPUT" : RETURN 
402 PRINT "BUDGET REPORTER" : RETURN 
450 LO = 1 : H% = K : II = 0
460 IF LO = H% AND  NN < > ABS (A1%(LO)) RETURN 
470 MD = INT ((LO + H%) / 2) : IF NN = ABS (A1%(MD))II = MD : RETURN 
480 IF NN > ABS (A1%(MD)) THEN LO = MD + 1 : GOTO 460 : :ELSE H% = MD - 1 : GOTO 460
500 D1 = INT (D / 10000!)
510 D2 = INT ((D - D1 * 10000!) / 100) : D3 = D - 10000! * D1 - 100 * D2 : RETURN 
550 D1 = 0 : GOTO 510
900 INPUT B$
902 IF LEN (B$) < > 5 + 3 * X% THEN 930 :ELSE D1$ = LEFT$ (B$,2) : D2$ = MID$ (B$,4,2) : D3$ = RIGHT$ (B$,2) : IF VAL (D1$) < 1 OR VAL (D1$) > 12 THEN 930
905 IF VAL (D2$) < 1 OR VAL (D2$) > 31 THEN 930 :ELSE IF X% = 1 THEN IF VAL (D3$) < 0 THEN 930
910 DT$ = D1$ + D2$ : IF X% = 1 THEN DT$ = DT$ + D3$ : RETURN :ELSE RETURN 
930 DT$ = " " : RETURN 
950 PRINT USING "##/##"; INT (D / 100);D - 100 * INT (D / 100); : RETURN 
960 PRINT USING "##/##/##"; INT (DT / 10000!); INT ((DT - 10000! * INT (DT / 10000!)) / 100);DT - 100 * INT (DT / 100); : RETURN 
1000 A$ = INKEY$ : IF A$ < > "@" RETURN 
1010 AB = 1 : PRINT : PRINT TAB( 5)"* ABORTED *" : PRINT : IF IO = 2 LPRINT "*** ABORTED ***"
1020 IF IO = 1 THEN GOSUB 1500 : RETURN :ELSE RETURN 
1500 IF DK = 1 CMD "T"
1510 PRINT @980,"PRESS ENTER TO CONTINUE"; : INPUT A$
1520 IF DK = 1 THEN CMD "R" : RETURN :ELSE RETURN 
2000 GOSUB 400 : PRINT : PRINT TAB( 5)"REPORT WILL GO TO

" TAB( 15)"0) RETURN TO MENU
" TAB( 15)"1) VIDEO DISPLAY
" TAB( 15)"2) LINE PRINTER
2020 PRINT : PRINT "ENTER YOUR CHOICE"; : INPUT B$ : IO = VAL (B$) : IF IO = 0 OR B$ = "END" THEN RETURN 
2025 IF (IO - 1) * (IO - 2) < > 0 THEN 2000
2030 IF IO = 2 PRINT : INPUT "READY LINE PRINTER, THEN PRESS ENTER";A$
2040 GOSUB 400 : PRINT : PRINT TAB( 5)"TYPE OF REPORT IS
" TAB( 15)"0) RETURN TO MENU
" TAB( 15)"1) ACCOUNTS
" TAB( 15)"2) OUTSTANDING CHECKS
" TAB( 15)"3) CANCELLED CHECKS
2050 PP = 0 : PRINT TAB( 15)"4) CASH EXPENSES
" TAB( 15)"5) DEPOSITS
" TAB( 15)"6) SAVINGS
2080 PRINT : PRINT "ENTER YOUR CHOICE"; : INPUT B$ : TY = VAL (B$) : IF TY = 0 OR B$ = "END" THEN RETURN 
2085 IF TY < 1 OR TY > 6 THEN 2040
2090 GOSUB 400 : PRINT : PRINT TAB( 5)"SEARCHING FOR
2100 PRINT TAB( 15)"0) RETURN TO MENU
" TAB( 15)"1) CANCELLED DATE
" TAB( 15)"2) CHECK NUMBER
" TAB( 15)"3) EXPENSES ACCOUNT
" TAB( 15)"4) DATE ENTERED
2110 PRINT TAB( 15)"5) DESCRIPTION
" TAB( 15)"6) AMOUNT
" TAB( 15)"7) ALL" : LK = 0 : PRINT 
2130 PRINT "ENTER YOUR CHOICE"; : INPUT B$ : LK = VAL (B$) : IF B$ = "END" OR LK = 0 THEN RETURN 
2135 IF LK < 1 OR LK > 7 THEN 2090 :ELSE IF TY = 3 THEN 2190
2140 IF TY = 1 AND (LK = 3 OR LK > 4) THEN 2190
2150 IF TY = 2 AND LK > 1 THEN 2190
2160 IF TY = 4 AND LK > 2 THEN 2190
2170 IF (TY = 5 OR TY = 6) AND LK > 3 THEN 2190
2180 PRINT TAB( 5)"* BAD REQUEST *" : GOSUB 320 : GOTO 2040
2190 PRINT : IF LK = 5 PRINT "ENTER DESCRIPTION"; TAB( 32); : INPUT R$ : GOTO 2300
2200 ON LK GOTO 2201,2202,2203,2201,2300,2206,2300
2201 PRINT "<LOW DATE>, <HIGH DATE>"; : GOTO 2210
2202 PRINT "<LOW CHECK#>, <HIGH CHECK#>"; : GOTO 2210
2203 PRINT "<LOW ACCOUNT#>, <HIGH ACCOUNT#>"; : GOTO 2210
2206 PRINT "<LOW AMOUNT>, <HIGH AMOUNT>";
2210 PRINT TAB( 32); : IF LK < > 1 AND LK < > 4 THEN 2250
2220 INPUT B$,C$ : GOSUB 902 : IF DT$ = " " THEN 2270 :ELSE R1 = VAL (DT$)
2230 B$ = C$ : GOSUB 902 : IF DT$ = " " THEN 2270 :ELSE R2 = VAL (DT$) : GOTO 2260
2250 INPUT R1,R2
2260 IF R1 < = R2 THEN 2300
2270 PRINT TAB( 5)"* BAD RANGE *" : GOTO 2190
2300 IF IO = 1 THEN 2330
2305 IF PEEK (14312) < 128 THEN 2330
2320 PRINT : PRINT "LINE PRINTER NOT READY!!" : INPUT "TYPE 1 WHEN READY, OR 0 TO RETURN TO MENU";I : IF I = 0 THEN RETURN :ELSE 2305
2330 GOSUB 3000
2340 GOSUB 3500 : GOSUB 1000 : IF AB = 1 THEN 2040
2360 GOSUB 4500 : GOSUB 1000 : IF AB = 1 THEN 2040
2365 IF EOD = 1 AND PP = 0 THEN A$ = "     * NO ENTRIES *" : IF IO = 1 THEN PRINT A$ : :ELSE LPRINT A$
2370 IF EOD = 1 THEN 2410
2380 GOSUB 6000 : PP = 1 : GOSUB 1000 : IF AB = 1 THEN 2040
2390 IF IO = 1 THEN CNT = CNT + 1 : IF CNT > 14 THEN GOSUB 1500 : GOTO 2340 : :ELSE 2360
2400 IF PEEK (16425) > 62 THEN LPRINT CHR$ (12) : GOTO 2340 : :ELSE 2360
2410 IF IO = 1 GOSUB 1500 : GOTO 2040
2420 LPRINT CHR$ (12) : GOTO 2040
3000 POKE 16424,67 : POKE 16425,1 : PG = 0 : CNT = 0 : EOD = 0 : KK = 0 : AB = 0
3010 ON TY GOTO 3011,3012,3013,3014,3015,3016
3011 H$ = "ACCOUNTS" : GOTO 3020
3012 H$ = "OUTSTANDING CHECKS" : GOTO 3020
3013 H$ = "CANCELLED CHECKS" : GOTO 3020
3014 H$ = "CASH EXPENSES" : GOTO 3020
3015 H$ = "DEPOSITS" : GOTO 3020
3016 H$ = "SAVINGS"
3020 IF IO = 2 THEN 3100
3030 IF TY < > 1 THEN 3060
3040 T$ = "   NO.       NAME                 CURRENT    BUDGET   REMAINING
3050 F$ = " ##### %                      %  #####.##  #####.##   #####.##-" : RETURN 
3060 T$ = "DATE         DESCRIPTION           AMOUNT" : F$ = "##/##     %                  %  ######.##-
3070 IF TY > 1 AND TY < 4T$ = "  NO.     " + T$ : F$ = "######    " + F$ : :ELSE T$ = STRING$ (10," ") + T$ : F$ = STRING$ (10," ") + F$
3080 IF TY > 1 AND TY < 5T$ = T$ + "   EXP. ACCT" : F$ = F$ + "  ######"
3090 IF TY = 3 THEN T$ = "  NO.   WRTN   CAN      DESCRIPTION           AMOUNT  EXP. ACCT" : F$ = "######  ##/## ##/##  %                  %  ######.##   ######" : RETURN :ELSE RETURN 
3100 IF TY < > 1 THEN 3130
3110 T$ = "  ACCOUNT        NAME                      CURRENT        BUDGET               PERCENT    REMAINING
3120 F$ = "   ##### %                            %  ###,###.##    ###,###.##             #####.##   ###,###.##-" : RETURN 
3130 T$ = "DATE            DESCRIPTION                      AMOUNT
3135 F$ = "##/##       %                          %      ###,###.##-
3140 IF TY > 1 AND TY < 4 THEN T$ = "  NUMBER       " + T$ : F$ = "  ######       " + F$ : :ELSE T$ = STRING$ (15," ") + T$ : F$ = STRING$ (15," ") + F$
3150 IF TY > 1 AND TY < 5T$ = T$ + "       EXPENSE" : F$ = F$ + "      #####
3160 IF TY = 3 THEN T$ = T$ + "      CANCELLED" : F$ = F$ + "         ##/##" : RETURN :ELSE RETURN 
3500 PG = PG + 1 : IF IO = 2 THEN 3530
3510 CLS : D = DT : GOSUB 500 : PRINT USING "BUDGET MANAGEMENT :  %                  %  PAGE ##  DATE ##/##/##";H$;PG;D1;D2;D3
3520 GOSUB 1000 : IF AB = 1 THEN RETURN :ELSE PRINT T$ : CNT = 2 : RETURN 
3530 GOSUB 3900 : LPRINT TAB( 40);"BUDGET MANAGEMENT REPORT" + STRING$ (25," "); : LPRINT USING "PAGE ##";PG
3540 LPRINT TAB( 40)"** "H$" REPORT **" : LPRINT TAB( 45)"DATE :  "; : D = DT : GOSUB 500 : LPRINT USING "##/##/##";D1;D2;D3
3550 GOSUB 1000 : IF AB = 1 THEN RETURN :ELSE GOSUB 3910 : LPRINT T$ : FOR I = 1 TO LEN (T$) : IF MID$ (T$,I,1) = " " THEN LPRINT " "; : :ELSE LPRINT "=";
3560 NEXT : LPRINT " " : RETURN 
3900 LPRINT STRING$ (110,"-")
3910 FOR DY = 1 TO 2 : LPRINT " " : NEXT : RETURN 
4500 EOD = 0 : KK = KK + 1 : ON TY GOTO 4540,4600,4680,4690,4740,4780
4510 EOD = 1 : RETURN 
4540 C$ = A2$(KK) : IF KK > K1 THEN 4510 :ELSE IF LK = 7 THEN 4580 :ELSE ON LK GOTO 4510,4510,4550,4510,4560,4570
4550 K = ABS (A1%(KK)) : IF K < INT (R1) OR K > INT (R2) THEN 4500 :ELSE 4580
4560 IF R$ < > C$ THEN 4500 :ELSE 4580
4570 R = CSNG (A3#(KK)) : IF R < R1 OR R > R2 THEN 4500 :ELSE 4580
4580 IF A4#(KK) = 0# THEN P = 0 : R# = 0# : :ELSE R# = A4#(KK) - A3#(KK) : P = A3#(KK) / A4#(KK) * 100
4590 L = INT (A6%(KK) - 10 * INT (A6%(KK) / 10)) : C$ = STRING$ (2 * L," ") + A2$(KK)
4595 IF L = 0 AND IO = 2 THEN LPRINT " " : RETURN :ELSE RETURN 
4600 IF KK > K2 THEN 4510 :ELSE IF C6%(KK) < > 0 THEN 4500
4610 C$ = C3$(KK) : IF LK = 7 THEN RETURN :ELSE ON LK GOTO 4670,4620,4660,4630,4910,4650
4620 R = C1%(KK) : GOTO 4900
4630 R = C2%(KK) : GOTO 4900
4650 R = C4(KK) : GOTO 4900
4660 R = ABS (A1%(C5%(KK))) : GOTO 4900
4670 R = C6%(KK) : GOTO 4900
4680 IF KK > K2 THEN 4510 :ELSE IF C6%(KK) = 0 THEN 4500 :ELSE 4610
4690 C$ = E2$(KK) : IF KK > K3 THEN 4510 :ELSE IF LK = 7 THEN RETURN :ELSE ON LK GOTO 4510,4510,4730,4700,4910,4720
4700 R = E1%(KK) : GOTO 4900
4720 R = E3(KK) : GOTO 4900
4730 R = ABS (A1%(E4%(KK))) : GOTO 4900
4740 C$ = D2$(KK) : IF KK > K4 THEN 4510 :ELSE IF LK = 7 THEN RETURN :ELSE ON LK GOTO 4510,4510,4510,4750,4910,4770
4750 R = D1%(KK) : GOTO 4900
4770 R = D3(KK) : GOTO 4900
4780 C$ = S2$(KK) : IF KK > K5 THEN 4510 :ELSE IF LK = 7 THEN RETURN :ELSE ON LK GOTO 4500,4500,4500,4790,4910,4810
4790 R = S1%(KK) : GOTO 4900
4810 R = S3(KK) : GOTO 4900
4900 IF R < R1 OR R > R2 THEN 4500 :ELSE RETURN 
4910 IF R$ < > C$ THEN 4500 :ELSE RETURN 
5000 IF E = 99 PRINT "* END OF RUN *" : END
5010 PRINT TAB( 5); : ON E GOTO 5011,5012,5013,5014,5015,5016,5017
5011 PRINT "* FILE NOT FOUND *" : RETURN 
5012 PRINT "* INPUT DATA EXCEEDS MEMORY ALLOCATION *" : RETURN 
6000 GOSUB 290 : ON TY GOTO 6006,6001,6001,6003,6004,6005
6001 D = C2%(KK)
6002 IF TY = 3 THEN GOSUB 550 : DY = D2 : YN = D3 : D = C6%(KK) : GOTO 6006 :ELSE 6006
6003 D = E1%(KK) : GOTO 6006
6004 D = D1%(KK) : GOTO 6006
6005 D = S1%(KK)
6006 GOSUB 550 : IF IO = 2 THEN 6100 :ELSE ON TY GOTO 6010,6020,6030,6040,6050,6060
6010 PRINT USING F$; ABS (A1%(KK));C$;A3#(KK);A4#(KK);R# : RETURN 
6020 PRINT USING F$;C1%(KK);D2;D3;C$;C4(KK); ABS (A1%(C5%(KK))) : RETURN 
6030 PRINT USING F$;C1%(KK);DY;YN;D2;D3;C$;C4(KK); ABS (A1%(C5%(KK))) : RETURN 
6040 PRINT USING F$;D2;D3;C$;E3(KK); ABS (A1%(E4%(KK))) : RETURN 
6050 PRINT USING F$;D2;D3;C$;D3(KK) : RETURN 
6060 PRINT USING F$;D2;D3;C$;S3(KK) : RETURN 
6100 ON TY GOTO 6110,6120,6130,6140,6150,6160
6110 LPRINT USING F$; ABS (A1%(KK));C$;A3#(KK);A4#(KK);P;R# : RETURN 
6120 LPRINT USING F$;C1%(KK);D2;D3;C$;C4(KK); ABS (A1%(C5%(KK))) : RETURN 
6130 LPRINT USING F$;C1%(KK);DY;YN;C$;C4(KK); ABS (A1%(C5%(KK)));D2;D3 : RETURN 
6140 LPRINT USING F$;D2;D3;C$;E3(KK); ABS (A1%(E4%(KK))) : RETURN 
6150 LPRINT USING F$;D2;D3;C$;D3(KK) : RETURN 
6160 LPRINT USING F$;D2;D3;C$;S3(KK) : RETURN 
9400 POKE I1,I2 : RETURN 
9500 JJ = J : J = 1 : GOSUB 400 : J = JJ : PRINT : I1 = 15423 : I2 = 32
9505 IO = 0 : IF DK = 1 THEN DV = 1 : ON ERROR GOTO 9900
9510 IF DK = 1 THEN LINE INPUT "FILESPEC OF INPUT FILE :  ";B$ : OPEN "I",DV,B$ : ON ERROR GOTO 0
9520 IF DK = 0 THEN DV = - 1 : INPUT "LOAD DATA TAPE(PLAY), THEN PRESS ENTER";A$
9530 INPUT #DV,D : PRINT "DATE OF DATA :      "; : GOSUB 950 : PRINT : PRINT "READING ACCOUNTS
9535 IF F = 1 THEN 9660
9540 INPUT #DV,K1 : IF K1 + 1 > M1 THEN 9700
9550 IF K1 < > 0 FOR I = 1 TO K1 + 1 : INPUT #DV,A1%(I),A2$(I),A3#(I),A4#(I),A6%(I) : GOSUB 9400 : NEXT 
9560 PRINT "READING CHECKS" : INPUT #DV,K2 : IF K2 > M2 THEN 9700
9570 IF K2 < > 0 FOR I = 1 TO K2 : INPUT #DV,C1%(I),C2%(I),C3$(I),C4(I),C5%(I),C6%(I) : GOSUB 9400 : NEXT 
9580 PRINT "READING CASH EXPENSES" : INPUT #DV,K3 : IF K3 > M3 THEN 9700
9590 IF K3 < > 0 FOR I = 1 TO K3 : INPUT #DV,E1%(I),E2$(I),E3(I),E4%(I) : GOSUB 9400 : NEXT 
9600 PRINT "READING DEPOSITS" : INPUT #DV,K4 : IF K4 > M4 THEN 9700
9610 IF K4 < > 0 FOR I = 1 TO K4 : INPUT #DV,D1%(I),D2$(I),D3(I) : GOSUB 9400 : NEXT 
9620 PRINT "READING SAVINGS DATA" : INPUT #DV,K5 : IF K5 > M5 THEN 9700
9630 IF K5 < > 0 THEN FOR I = 1 TO K5 : INPUT #DV,S1%(I),S2$(I),S3(I) : GOSUB 9400 : NEXT 
9640 F = 1 : IF DK = 1 THEN CLOSE : RETURN :ELSE RETURN 
9660 INPUT #DV,K : IF K = 0 THEN 9680
9665 FOR I = 1 TO K : INPUT #DV,NN,A2$,A3#,A4#,A6% : GOSUB 9400 : IF I < 4 NEXT 
9670 NN = ABS (NN) : GOSUB 450 : IF II = 0 NEXT : GOTO 9680
9675 A3#(II) = A3#(II) + A3# : A4#(II) = A4#(II) + A4# : NEXT 
9680 GOSUB 320 : F = 1 : IF DK = 1 THEN CLOSE : RETURN :ELSE RETURN 
9700 E = 2 : GOSUB 5000 : GOSUB 320 : RETURN 
9900 I = ERR / 2 + 1 : IF I = 54 THEN E = 1 : GOSUB 5000 : RESUME 9510
9910 PRINT : PRINT "UNEXPECTED ERROR #"I"IN LINE" ERL "-- RUN ABORTED" : END
